package day1.problem1;

//BC153.数字统计
//https://www.nowcoder.com/practice/179d9754eeaf48a1b9a49dc1d438525a?tpId=290&tqId=39941&ru=/exam/oj

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int l = scanner.nextInt();
        int r = scanner.nextInt();
        int sum = 0;
        for(int i = l; i<=r; i++) {
            sum += count(i);
        }
        System.out.println(sum);
    }

    public static int count(int x) {
        int ret = 0;
        while(x > 0) {
            if(x % 10 == 2) ret++;
            x /= 10;
        }
        return ret;
    }
}